package com.shareach.domain;

import java.util.Arrays;
import java.util.Date;

import org.apache.commons.lang.StringUtils;
import org.springframework.data.mongodb.core.mapping.Document;

import com.shareach.domain.common.Entity;

@Document(collection = "baseBank")
public class BaseBankDomain extends Entity {
	// 名称
	private String name;
	// 别名
	private String[] alias;
	// 对应电话
	private String[] tel;
	//
	private String icon;
	// 简称
	private String simpleName;
	// 标石
	private String mark;

	// 创建时间
	private Date creatTime;

	// 更新时间
	private Date updateTime = new Date();

	// 上架时间
	private Date deployTime;

	public String[] getAlias() {
		return alias;
	}

	public Date getCreatTime() {
		return creatTime;
	}

	public Date getDeployTime() {
		return deployTime;
	}

	public String getIcon() {
		return icon;
	}

	public String getMark() {
		return mark;
	}

	public String getName() {
		return name;
	}

	public String getSimpleName() {
		return simpleName;
	}

	public String[] getTel() {
		return tel;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setAlias(String[] alias) {
		this.alias = alias;
	}

	public void setCreatTime(Date creatTime) {
		this.creatTime = creatTime;
	}

	public void setDeployTime(Date deployTime) {
		this.deployTime = deployTime;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public void setMark(String mark) {
		this.mark = mark;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setSimpleName(String simpleName) {
		this.simpleName = simpleName;
	}

	public void setTel(String[] tel) {
		this.tel = tel;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public BaseBankDomain compareTo(BaseBankDomain domain) {
		BaseBankDomain change = new BaseBankDomain();
		if (null == domain)
			return change;
		if (StringUtils.isNotEmpty(domain.getIcon())) {
			if (this.icon == null || !this.icon.trim().equals(domain.getIcon().trim())) {
				change.setIcon(domain.getIcon().trim());
			}
		}
		if (StringUtils.isNotEmpty(domain.getSimpleName())) {
			if (this.simpleName == null || !this.simpleName.trim().equals(domain.getSimpleName().trim())) {
				change.setSimpleName(domain.getSimpleName().trim());
			}
		}
		if (StringUtils.isNotEmpty(domain.getMark())) {
			if (this.mark == null || !this.mark.trim().equals(domain.getMark().trim())) {
				change.setMark(domain.getMark().trim());
			}
		}
		if (null != domain.getTel() && domain.getTel().length > 0) {
			if (this.tel == null || !Arrays.equals(this.tel, domain.getTel())) {
				change.setTel(domain.getTel());
			}
		}
		if (null != domain.getAlias() && domain.getAlias().length > 0) {
			if (this.alias == null || !Arrays.equals(this.alias, domain.getAlias())) {
				change.setAlias(domain.getAlias());
			}
		}
		if (StringUtils.isNotEmpty(domain.getName())) {
			if (this.name == null || !this.name.trim().equals(domain.getName().trim())) {
				change.setName(domain.getName().trim());
			}
		}
		return change;
	}

}
